package untils

import (
	"fmt"
	"house-src/basic/config"
	"time"
)

// 添加分布式锁
func LockCleaner(cleanerId int64) bool {
	key := fmt.Sprintf("cleanerId:%d", cleanerId)
	_, err := config.Rdb.SetNX(config.Ctx, key, cleanerId, time.Minute*5).Result()
	if err != nil {
		return false
	}
	return true
}
